<?xml version="1.0"?> 

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<!--______________________________________________________________________-->

	<xsl:output method="text" />
	
	<!--______________________________________________________________________-->

	<xsl:template match="/">

/**
 * @author Valter
 */

package persistence;

import persistence.*;

public aspect PartialAwareness{
			
  declare precedence: PartialAwareness+, OORelationalMapping+;
	
  pointcut excludedJoinPoints(): 
     !call(public void PersistentRoot+.setID(..)) &amp;&amp;
     !call(public void PersistentRoot+.setTableName(..)) &amp;&amp;
     !call(public void PersistentRoot+.setKeyName(*)) &amp;&amp;
     !call(public void PersistentRoot+.setColValues(Integer, int)) &amp;&amp;
     !call(public void PersistentRoot+.setColValues(..)) &amp;&amp;
     !call(public void PersistentRoot+.setColNamesException(*))&amp;&amp;
     !call(public void PersistentRoot+.setCols(*));

  
  pointcut update(PersistentRoot pr):	
  			target(pr)
			&amp;&amp; call (public void (PersistentRoot+ &amp;&amp; !PersistentRoot).set*(*))

			&amp;&amp; excludedJoinPoints(); 
  
  pointcut save(PersistentRoot pr): 
  			target(pr)
			&amp;&amp; execution ((PersistentRoot+ &amp;&amp; !PersistentRoot).new(*, ..));
  
  pointcut saveOrUpdate(PersistentRoot pr):  
  	        save(pr) || update(pr);
 	
  after(PersistentRoot pr): saveOrUpdate(pr){
  try
  {
  		System.out.println("--- PersistencyPartialAwareness : The joinPoint " + thisJoinPoint + " was reached !");
  		if (pr.save()){
  			
  			System.out.println("All right with the saving of the object " + pr.getClass().getName());
  			
  		}else{
  			
  			throw new StoringException(pr);
  			
  		}
  	
  }catch(StoringException e){
  	
  	System.out.println("CATCH: PersistencePartialAwareness: " + e.getMessage());
  	
  }
  }
  

}


	</xsl:template>

</xsl:stylesheet>